package com.lb.activity.vo;

import com.lb.activity.po.Dept;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Xiao
 * @create 2018-11-12 18:10
 **/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class SimpleDeptVO {
    private Long id;
    private String deptName;

    public static SimpleDeptVO parse(Dept dept) {
        return new SimpleDeptVO(dept.getId(),dept.getDeptName());
    }

    public static List<SimpleDeptVO> parse(List<Dept> depts) {
        if(depts == null || depts.size() == 0) {
            return null;
        }
        List<SimpleDeptVO> list = new ArrayList<>();
        for(Dept dept : depts) {
            list.add(parse(dept));
        }
        return list;
    }

}
